﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BusinessLogic
{
    public abstract class CodeTable : Table
    {
        private string _description;

	    public CodeTable(Guid id, string description) : base(id)
	    {        
            _description = description;
		}

        public CodeTable(Guid id) : base(id) { }
        public CodeTable(string description) : this(Guid.Empty, description) { }
        public CodeTable() : this(Guid.Empty, string.Empty) { }
        
        [SQLParameter(ColumnName = "DESCRIPTION", SQLDoWhat = SQLDoWhatEnum.Get)]
        [SQLParameter(ColumnName = "EMAILADDRESSTYPECODE", SQLDoWhat = SQLDoWhatEnum.Get)]
        [SQLParameter(ColumnName = "STATE", SQLDoWhat = SQLDoWhatEnum.Get, TypeOf = typeof(State))]
        [SQLParameter(ColumnName = "COUNTRY", SQLDoWhat = SQLDoWhatEnum.Get, TypeOf = typeof(Country))]  
        [SQLParameter(ColumnName = "DESCRIPTION", ParameterName = "@DESCRIPTION", SQLDoWhat = SQLDoWhatEnum.Create)]
        [SQLParameter(ColumnName = "DESCRIPTION", ParameterName = "@DESCRIPTION", SQLDoWhat = SQLDoWhatEnum.Update)]
        public string Description 
        { 
            get
            { 
                return _description; 
            }
            set
            {
                _description = value;   
            }
        }

        public override abstract DatabaseInteractionDescriptor TableInteractionDescription();
    }
}